package com.guo.dms.dept.permission.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.guo.dms.common.tree.entity.TreeNode;
import com.guo.dms.common.tree.util.TreeUtils;
import com.guo.dms.dept.permission.dao.PermssionDao;
import com.guo.dms.dept.permission.entity.Permission;

@Controller
@RequestMapping("/sys/permission")
public class PermissionController {
	@Autowired
	private PermssionDao permissionDao;
	
	@RequestMapping("")
	public String list(ModelMap model){
		List<Permission> perms = permissionDao.selectAllPermissions();
		List<TreeNode>  trees=TreeUtils.getNodeTrees(perms);
		model.addAttribute("permTrees",trees);
		return "common/permission/list";
	}
}
